package com.sc.test;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * Created by Shen Chao on 2018-01-10-010 上午 9:09.
 */

public class CustomView extends FrameLayout {
    private ImageView imageView;
    public CustomView(@NonNull Context context) {
        super(context);
    }

    public CustomView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        imageView = new ImageView(getContext());
        addView(imageView,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    }

    public  void  setImage(Drawable drawable){
        imageView.setImageDrawable(drawable);
    }
}
